// 个人中心管理接口
import $http from "./request";

// 注册
export function register(data = {}) {
  return $http.request({
    url: "IMine/register",
    method: "POST",
    header: {
      "Content-Type": "application/json",
    },
    data,
  });
}

// 登录
export function login(data = {}) {
  return $http.request({
    url: "IMine/login",
    method: "POST",
    header: {
      "Content-Type": "application/json",
    },
    data,
  });
}

// 根据用户ID获取用户数据
export function getUserById(data = {}) {
  return $http.request({
    url: "IMine/getUserById",
    method: "POST",
    header: {
      "Content-Type": "application/json",
    },
    data,
  });
}

// 根据用户ID更新用户数据
export function updateUserById(data = {}) {
  return $http.request({
    url: "IMine/updateUserById",
    method: "POST",
    header: {
      "Content-Type": "application/json",
    },
    data,
  });
}

// 查询用户余额
export function getBalance(data = {}) {
  return $http.request({
    url: "IMine/getBalance",
    method: "POST",
    header: {
      "Content-Type": "application/json",
    },
    data,
  });
}

// 查询默认地址
export function getDefaultAddr(data = {}) {
  return $http.request({
    url: "IMine/getDefaultAddr",
    method: "POST",
    header: {
      "Content-Type": "application/json",
    },
    data,
  });
}


// 查询用户所有的收货地址
export function getAddressAll(data = {}) {
  return $http.request({
    url: "IMine/getAddressAll",
    method: "POST",
    header: {
      "Content-Type": "application/json",
    },
    data,
  });
}

// 保存收货地址 更新或新增
export function addressSave(data = {}) {
  return $http.request({
    url: "IMine/addressSave",
    method: "POST",
    header: {
      "Content-Type": "application/json",
    },
    data,
  });
}

// 查询用户所有的订单
export function getOrderAll(data = {}) {
  return $http.request({
    url: "IMine/getOrderAll",
    method: "POST",
    header: {
      "Content-Type": "application/json",
    },
    data,
  });
}
